package cn.com.assistant.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Transient;

import java.util.Date;
import java.util.List;

@Data
@TableName("answer")//@TableName中的值对应着表名
@ApiModel(description = "问题回复表")
public class AnswerEntity {

    /**
     * 主键
     * @TableId中可以决定主键的类型,不写会采取默认值,默认值可以在yml中配置
     * AUTO: 数据库ID自增
     * INPUT: 用户输入ID
     * ID_WORKER: 全局唯一ID，Long类型的主键
     * ID_WORKER_STR: 字符串全局唯一ID
     * UUID: 全局唯一ID，UUID类型的主键
     * NONE: 该类型为未设置主键类型
     */
    @TableId(value = "id",type = IdType.INPUT)
    @ApiModelProperty(value = "id")
    private String id;

    @ApiModelProperty(value = "用户所问问题关联id")
    private String questionId;

    @ApiModelProperty(value = "文字描述")
    private String description;

    @ApiModelProperty(value = "图片地址")
    private String imgUrl;

    @TableField(exist = false)
    @ApiModelProperty(value = "图片地址列表")
    private List<String> imgUrlList;

    @ApiModelProperty(value = "答案顺序")
    private Integer weight;

    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss",
            timezone = "GMT+8"
    )
    @ApiModelProperty(value = "创建时间")
    private Date createdDate;

    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss",
            timezone = "GMT+8"
    )
    @ApiModelProperty(value = "更新时间")
    private Date updatedDate;

    @ApiModelProperty(value = "问题子级回复")
    private List<CasAnswerEntity> casAnswerEntities;


}
